home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_084 / ed / optpat.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  723b  |  42 lines

  1. /*
  2.  * Copyright 1987 Brian Beattie Rights Reserved.
  3.  *
  4.  * Permission to copy and/or distribute granted under the
  5.  * following conditions:
  6.  *
  7.  * 1). No charge may be made other than resonable charges
  8.  *    for reproduction.
  9.  *
  10.  * 2). This notice must remain intact.
  11.  *
  12.  * 3). No further restrictions may be added.
  13.  *
  14.  */
  15. #include <stdio.h>
  16. #include "tools.h"
  17. #include "ed.h"
  18.  
  19. TOKEN    *
  20. optpat(oldpat)
  21. TOKEN    *oldpat;
  22. {
  23.     char    delim, str[MAXPAT], *cp;
  24.  
  25.     delim = *inptr++;
  26.     cp = str;
  27.     while(*inptr != delim && *inptr != NL)
  28.     {
  29.         if(*inptr == ESCAPE)
  30.             if(inptr[1] == '/' || inptr[1] == '?')
  31.                 inptr++;
  32.         *cp++ = *inptr++;
  33.     }
  34.  
  35.     *cp = EOS;
  36.     if(*str == EOS)
  37.         return(oldpat);
  38.     if(oldpat)
  39.         unmakepat(oldpat);
  40.     return(getpat(str));
  41. }
  42.